#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>

int main(int argc, char const *argv[])
{
    int val = 4399;
    pid_t pid = fork();
    if (pid==0)
    {
        val++;
        printf("我是子进程,我的val=%d,子地址是%p,我的id是%d,父亲是%d\n", val,&val,getpid(),getppid());
    }else if (pid>0)
    {
        val--;
        printf("我是父进程,我的val=%d,父地址是%p,我的id是%d,子地址是%d\n", val,&val,getpid(),pid);
    }
    
    
    return 0;
}
